#ifndef OBJLOADER_H_
#define OBJLOADER_H_

#include "geometry.h"
#include "material.h"
#include <fstream>
#include <vector>
#include <string.h>

struct Cache {
	UINT index;
	Cache *next;
};

class ObjLoader {
public:
	ObjLoader();
	~ObjLoader();

	bool InitialiseModel(WCHAR* dir, WCHAR* model);
private:
	bool LoadMtl(WCHAR* mtl);
	bool LoadObj(WCHAR* obj);

	// method based on MeshFromObj tutorial
	DWORD addVertex(UINT hash, ptn::Vertex *v);

	WCHAR dir[MAX_PATH];

	std::vector<Cache *> cache;
public:
	std::vector<pod::Material *> pod_materials;
	std::vector<UINT> pod_attributes;
	std::vector<DWORD> pod_indices;
	std::vector<ptn::Vertex> pod_vertices;
};
#endif
